Challenger O-Ring Case Study
Welcome
This tutorial allows you to interactively explore R, writing and running code in your web browser. You’ll see above R is being set-up and loading packages right in this browser window. This tutorial created by Brennan Antone using WebR and Quarto.
What are packages? In R, packages are collections of functions that someone has put together. Functions are instructions you use to tell R to do something, potentially transforming some inputs into some outputs. For instance the print() function tells R to print to the display anything you input to it. You can try it by running the code below.
You can modify the code above and try running it again. For instance, you can try replacing the expression 2+2 with a string that contains text within quotes, such as “Hello World”.
Anyone using R can write their own functions, and they can compile functions into packages to share with others. When you install and load a package, you are teaching your copy of R how to do new things. Some common functions, like print are built into Base R, so that any copy of R can use them without needing to install and load additional packages.
Case Context
The engineers working on the Challenger were worried about the potential for O-ring failure. Raw data was presented in tabular form along with diagrams like the one below, which show how erosion in the primary O-ring interacted with the secondary O-ring:
To start with, let’s pull the raw data engineers had from previous Challenger Shuttle launches. We will put it in a table so that we can visualize it.
1) Examine Data
This is the type of tabular information that the Challenger engineers presented to their management. First, we will read in data from a csv, in this case a csv file hosted on the web. This is done using the read.csv function, which takes two arguments(inputs to the function). We we use this to specify the file’s url, as well as that it contains a header (first row with variable names).
We will assign this data to a variable so that we can reference it later. We must choose a name for this variable, in this case we will call it my_data. Note that in the code below we store the data in a variable, but we don’t instruct R to output anything, so no text will appear after the code executes.
Now we can access the data we stored. If we just enter the variable name, R will display the data.
This is the data the Nasa Engineers presented to their bosses. We can see that the dataset contains observations about the temperatures of launches and O-ring damage, but we don’t yet have information. One step forward towards information is to simply plot the data to see if there might be a relationship between temperature and O-ring damage.
2) Plot Data
Using the library() function, we can load the ggplot2 package. This package contains functions that we will use to create a plot. We will store the plot in a variable, my_plot, and then output the plot the display.
The graph above shows O-ring damage on the y-axis and temperature on the x-axis. We can easily see that no prior launches below 66 degrees F were damage-free, and it appears that at lower temperatures (such as 55 degrees) the damage was even more severe.
Now, what temperature was forecasted for the day of the Challenger launch? 26 to 29 degrees. Let’s add that context to our plot.
You can try tweaking the code above to change the labels and the scope of the x- and y- axises.
Looking at this plot, now we have some information. The transformation of the raw data into a visualization makes it obvious that the temperature forecasted for the day of the Challenger launch should raise red flags. It falls far below the temperature range of prior launches, and those prior launches suggest that O-ring damage may be correlated with decreasing temperature.
To their credit, the engineers working on the Challenger were worried about the potential for O-ring failure. But the critical step in making the link to temperature was not thoroughly communicated. Instead, the raw data was presented in tabular form alongside unclear diagrams.
Without the scatterplot, the critical information about the relationship between launch temperature and O-ring damage is not obvious. The scatterplot achieves this without putting much cognitive load on the viewer. Just about anyone can look at that plot and understand that the forecasted temperature on January 28, 1986 might be a risk for O-ring failure.
References:
This material is adapted from an article and code by Dr. John Paul Helveston.
The Space shuttle Challenger explosion blog post, by Vikram Dayal
Robison et al. (2002) Representation and Misrepresentation: Tufte and the Morton Thiokol Engineers on the Challenger, Science and Engineering Ethics, 8, 59-81.
Tufte, Edward R. (1997) “Visual Explanations: Images and Quantities, Evidence and Narrative”, Graphics Press, Cheshire, Connecticut.